(function() {
    var countDownTimer = (total,Interval,onTick,onFinish)=>{
        var CountDown = ()=>{
            total-=Interval;
            if (total > 0) {
                onTick(total);
            } else{
                clearInterval(timer);
                onFinish();
            }
        };
        var timer = setInterval(CountDown, Interval);
    };
    module.exports = countDownTimer;
})();

// require("./countDownTimer")(10000,1000,(n)=>{
//     console.log(n);
// },()=>{
//     console.log("======");
// });